﻿Imports Telerik.Web.UI

Partial Class MasterPageLogin
    Inherits System.Web.UI.MasterPage


    Protected Sub imgLanguage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles imgLanguage.Click

        Dim langAr As String = "ar-JO"
        Dim langEn As String = "En-GB"

        If Not (Request.Cookies("Language") Is Nothing) AndAlso Not (Request.Cookies("Language").Value Is Nothing) Then

            If (Request.Cookies("Language").Value = "ar-JO") Then
                Response.Cookies("Language").Value = langEn
            ElseIf (Request.Cookies("Language").Value = "En-GB") Then
                Response.Cookies("Language").Value = langAr
            End If

        Else
            If imgLanguage.Text = "الـعـربـيــة" Then
                Dim cookie As New HttpCookie("Language")
                cookie.Value = langAr
                Response.Cookies.Add(cookie)
            ElseIf imgLanguage.Text = "English" Then
                Dim cookie As New HttpCookie("Language")
                cookie.Value = langEn
                Response.Cookies.Add(cookie)
            End If

        End If

        Dim url As String = Request.AppRelativeCurrentExecutionFilePath
        Response.Redirect(url)
    End Sub

End Class

